<?php
declare(strict_types=1);

use Phinx\Db\Adapter\MysqlAdapter;
use Phinx\Migration\AbstractMigration;

final class CreateUrgeMessageMemberTable extends AbstractMigration
{
    public function up()
    {
        $table = $this->table('urge_message_member', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '催一催成员表']);
        $table->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '催一催成员id'])
            ->addColumn('urge_message_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '催一催记录id'])
            ->addColumn('user_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '用户id'])
            ->addColumn('param', 'json', ['null' => true, 'comment' => '额外参数'])
            ->addColumn('is_sender', 'integer', ['signed' => false, 'default' => 0, 'limit' => MysqlAdapter::INT_TINY, 'comment' => '是否是发送者(0 不是,1 是)'])
            ->addColumn('is_delete', 'integer', ['signed' => false, 'default' => 0, 'limit' => MysqlAdapter::INT_TINY, 'comment' => '是否删除了催一催记录(0 不是,1 是)'])
            ->addColumn('is_read', 'integer', ['signed' => false, 'default' => 0, 'limit' => MysqlAdapter::INT_TINY, 'comment' => '是否已读(0 不是,1 是)'])
            ->addColumn('created', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建时间'])
            ->save();
    }

    public function down()
    {
        $this->table('urge_message_member')->drop()->save();
    }
}
